package org.lyd.spring.ioc.bean;

import lombok.Data;
import lombok.ToString;
import org.lyd.spring.ioc.annotation.UUID;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author:lyd
 * BeanPostProcessor
 **/
@ToString
@Data
public class User implements InitializingBean, DisposableBean {
    private String name;
    private Integer age;
    @UUID
    private String sex;
    private Dog dog;

    public User() {
        System.out.println("User构造方法执行");
    }


    @Autowired
    public void setDog(Dog dog) {
        System.out.println("set注入:"+dog);
        this.dog = dog;
    }

    private void initUser() {
        System.out.println("@Bean:"+"initUser方法执行");
    }

    private void destroyUser() {
        System.out.println("@Bean:"+"destroyUser方法执行");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy方法执行");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet方法执行");
    }


}
